package com.abc.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * @Value注解只能在spring管理的bean中使用，不在spring管理的bean怎么读取yml配置内容,参考 https://blog.csdn.net/xiao______xin/article/details/73274830
 *
 * 先创建一个对象 用于映射该配置文件的值 如下:
 * 该对象中一定要有@Component
 */
@Component
@ConfigurationProperties(prefix = "white-list")
public class WhiteListProperties {

    private String allowPaths;

    public String getAllowPaths() {
        return allowPaths;
    }

    public void setAllowPaths(String allowPaths) {
        this.allowPaths = allowPaths;
    }

    @Override
    public String toString() {
        return "WhiteListProperties{" +
                "allowPaths='" + allowPaths + '\'' +
                '}';
    }
}
